package com.huang.service.impl;

import com.huang.entity.Film;
import com.huang.mapper.FilmMapper;
import com.huang.service.FilmService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@Slf4j
public class FilmServiceImpl implements FilmService {

    @Resource
    private FilmMapper filmMapper;
    @Override
    public List<Film> queryAll() {
        return filmMapper.queryAll();
    }

    @Override
    public Film queryById(Integer filmId) {
        return filmMapper.selectById(filmId);
    }

    @Override
    public List<Film> queryByTitle(String title) {
        return filmMapper.selectByTitle(title);
    }

    @Override
    public void addOne(Film film) {
        log.info("film is {}",film);
        filmMapper.insertOne(film);
    }

    @Override
    public void modOne(Film film) {
        log.info("film is {}",film);
        filmMapper.updateOne(film);
    }

    @Override
    public void removeOne(Integer filmId) {
        filmMapper.deleteOne(filmId);
    }
}
